bpo-45385: Fix reference leak from descr_check#28719
Conversation
vstinner
left a comment
There was a problem hiding this comment.
Your commit title is misleading. What your PR does it is to fix compiler warnings in Objects/descrobject.c. It's unrelated to GitHub Action. It's just that you noticed them thanks for GHA.
There was a problem hiding this comment.
Maybe descr_check() should set res to NULL when it returns 0, whereas having to modify all functions using it.
There was a problem hiding this comment.
If you modify descr_check() for that, maybe add a comment to explain that it's only set to NULL to prevent compiler warnings.
I detected the warning from the PR but I will update the content not to mention the PR :) |
There was a problem hiding this comment.
@vstinner
Thanks Victor for review :)
Is this what you intended?
Will be fixed at #28716 |
Fidget-Spinner
left a comment
There was a problem hiding this comment.
LGTM in general. Thank you!
|
@vstinner @Fidget-Spinner |
There was a problem hiding this comment.
Would you mind to use Py_NewRef()?
There was a problem hiding this comment.
I don't think we can, the bugfix needs to be backported to 3.9. Py_NewRef was added in 3.10. Unless you mean Py_NewRef for 3.11, 3.10 and manual backport for 3.9.
There was a problem hiding this comment.
3.10 backport should not prevent to write better code in the main branch. The backport can be different.
There was a problem hiding this comment.
@vstinner @Fidget-Spinner
I will backport it manually :)
Fidget-Spinner
left a comment
There was a problem hiding this comment.
LGTM. Just needs a news IMO.
There was a problem hiding this comment.
Wow, why did this (and the code below) change too? I don't think this was buggy, though the new code improves readability/makes it easier to understand.
I'm guessing for consistency reasons?
There was a problem hiding this comment.
I asked @corona10 to mention compiler warnings in the commit message. I cannot see compiler warnings in https://bugs.python.org/issue45385, in the PR description, or in the commit message.
There was a problem hiding this comment.
I'm guessing for consistency reasons?
Yes and it improve the readability :)
There was a problem hiding this comment.
There is no need to cast the Py_NewRef() argument to PyObject*.
vstinner
left a comment
There was a problem hiding this comment.
LGTM. But please mention the fixed compiler warnings in the commit message and/or in the bpo.
"Fix possible reference leak". Either there is a leak or not leak. I suggest to remove "possible".
|
🤖 New build scheduled with the buildbot fleet by @Fidget-Spinner for commit 336434c 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
|
Thanks @corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
|
@corona10: Please replace |
|
GH-28779 is a backport of this pull request to the 3.10 branch. |
(cherry picked from commit e6ff4eb) Co-authored-by: Dong-hee Na <donghee.na@python.org>
|
(cherry picked from commit e6ff4eb) Co-authored-by: Dong-hee Na <donghee.na@python.org>
motivation:
https://bugs.python.org/issue45385